package com.hit.sys.config;

import cn.hutool.cache.CacheUtil;
import cn.hutool.cache.impl.TimedCache;
import com.hit.core.pojo.login.SysLoginUser;
import com.hit.sys.core.cache.UserCache;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class CacheConfig {

    /**
     * 登录用户的缓存
     */
    @Bean
    public UserCache userCache() {
        TimedCache<String, SysLoginUser> timedCache = CacheUtil.newTimedCache(2 * 60 * 1000L);
        return new UserCache(timedCache);
    }

}
